<?php

/**
 * 自定义方法：
 * 
 * 
 * 添加评论者IP的相关信息
 * 
 */
 


//IP 端口 获取与存储
add_action('wp_insert_comment', 'wp_insert_ipport', 10, 2);
function wp_insert_ipport($comment_ID, $commmentdata)
{
	$ipport = $_SERVER['REMOTE_PORT'];
	update_comment_meta($comment_ID, '_ipport', $ipport);
}
//为 IP Port 栏目添加 CSS
function ipport_css()
{
?>
	<style type="text/css">
		#_ipport {
			width: 80px;
			color: #0073aa;
		}

		/* CSS for ipport columns */
		#_userip {
			width: 100px;
			color: #0073aa;
		}

		/* CSS for ip columns */
		#author_ip {
			width: 100px;
			color: #0073aa;
		}

		/* CSS for ip columns */
	</style>
<?php
}
add_action('admin_head', 'ipport_css');
//后台评论添加 IP 端口栏目
add_filter('manage_edit-comments_columns', 'my_comments_columns');
add_action('manage_comments_custom_column', 'output_my_comments_columns', 10, 2);
function my_comments_columns($columns)
{
	#   $columns[ '_userip' ] = __( 'IP地址' );        //User IP 代表列的名字
	$columns['author_ip'] = __('IP地址');        //User IP 代表列的名字
	$columns['_ipport'] = __('端口号');        //IP Port 代表列的名字
	return $columns;
}
function output_my_comments_columns($column_name, $comment_id)
{
	switch ($column_name) {
		case "author_ip":
			echo get_comment_author_IP($comment_id, 'author_ip', true);
			break;
			#       case "_userip" :
			#       echo get_comment_meta( $comment_id, '_userip', true );
			#       break;
		case "_ipport":
			echo get_comment_meta($comment_id, '_ipport', true);
			break;
	}
}


function wptutsplus_login_logo() { ?>
 <style type="text/css">
    /* 登陆页面样式 */
    .clearfix:after {
        content: ".";
        display: block;
        height: 0;
        clear: both;
        visibility: hidden;
    }

    .clearfix {
        display: block;
    }

    /* common */
    html {
        overflow: hidden;
        background-color: #000;
    }

    body {
        overflow: hidden;
        background-position: center;
        background-size: cover;
        background-image: url(https://static.likepoems.com/2020/09/19/6e2b0cb2d3813c47be1b6d554adfbc6c8.jpg);
    }

    .login #login_error,
    .login .message {
        /*position: absolute;
        top: -70px;*/
        left: 0;
        top: 0;
        position: fixed;
        margin-bottom: 0 !important;
        background: rgba(255, 255, 255, 0.45);
    }

    #login h1 a {
        font-family: "Microsoft Yahei";
        font-weight: bold;
        text-indent: 0px;
        font-size: 0px;
        height: 60px;
        width: 100%;
        line-height: 88px;
        line-height: 180%;
        text-align: center;
        color: #FFF;
        /*text-shadow:1px 1px 0px #000;*/
        margin-bottom: 10px;
        margin-top: 25px;
        background-image: url(https://static.likepoems.com/cdn/iro/logo.jpg);
        background-position: center bottom !important;
        background-size: contain;
        padding-top: 20px;
        box-shadow: none;
    }

    input:-webkit-autofill {
        -webkit-box-shadow: 0 0 0px 1000px rgba(0, 0, 0, 0) inset;
        box-shadow: 0 0 0px 1000px rgba(0, 0, 0, 0) inset;
        color: #676767 !important
    }

    #login {
        font: 14px/1.4 "Helvetica Neue", "HelveticaNeue", Helvetica, Arial, sans-serif;
        position: absolute;
        background: #FFF9;
        border-radius: 12px;
        top: 50%;
        left: 50%;
        width: 350px;
        padding: 0px !important;
        margin: -235px 0px 0px -175px !important;
        background-position: center 48%;
        backdrop-filter: blur(5px);
        -webkit-backdrop-filter: blur(5px);
    }

    #login form {
        padding: 10px 0px;
        background: none;
        box-shadow: none;
        margin-top: 10px;
        border: none;
    }

    #login form p,
    #login form .user-pass-wrap {
        font-family: "Microsoft Yahei";
        position: relative;
        padding: 0px 35px;
    }

    #login a {
        /*text-shadow:1px 1px 0px #000;*/
        color: #000 !important;
        font-family: "Microsoft Yahei";
    }

    #login_error a {
        color: #000 !important;
        /*text-shadow:1px 1px 0px #FFF;*/
    }

    #login form label {
        color: #333;
        color: #585858;
    }

    #login form .input {
        border: 1px solid #EAEAEA;
        border-radius: 0px;
        background: none;
        padding: 5px 15px;
        color: #444;
        font-weight: normal;
        font-size: 16px;
        background: #FFF;
        font-family: "Microsoft Yahei";
        box-shadow: 0 0 0px 1000px white inset;
        height: 46px;
        border-radius: 12px;
        margin-top: 10px;
    }

    #login form .input:active {
        box-shadow: 0 0 0px 1000px white inset;
        color: #676767 !important;
    }

    #login form .input:focus {
        box-shadow: 0 0 0px 1000px white inset;
        color: #676767 !important;
        border: 1px solid #FF5656;
    }

    .login .button.wp-hide-pw {
        height: 46px;
        outline: none;
        box-shadow: none;
        border: none;
        opacity: .8;
    }

    .login .button.wp-hide-pw .dashicons {
        right: 1rem;
        top: 0.2rem;
    }

    #login .form-send .bot {
        width: 100%;
        border-bottom: 1px solid #ccc;
    }

    #login form .forgetmenot {
        float: none;
    }

    #login form p.submit {
        padding: 0px 35px !important;
    }

    #login .submit .button {
        width: 50%;
        margin-top: 10%;
        margin-bottom: 5%;
        margin-left: 25%;
        margin-right: 25%;
        border: none;
        float: none;
        border-radius: 12px;
        height: 45px;
        font-size: 16px;
        text-align: center;
        color: #FFF;
        /*background:#505050;*/
        font-weight: normal;
        cursor: pointer;
        box-shadow: none;
        text-shadow: none;
    }

    .login #nav,
    #backtoblog {
        /*display:none*/
        color: #585858 !important;
    }

    .login #backtoblog {
        display: none
    }

    .login #nav {
        margin: 0;
        margin-bottom: 15px;
        margin-left: 2.5%;
        text-align: center;
    }

    .login .ds-login {
        margin-left: 38px;
    }

    .login form input[type=checkbox] {
        background: #FFFFFF;
        box-shadow: none;
        width: 20px;
        height: 20px;
        border-radius: 2px;
    }

    input[type=checkbox]:checked:before {
        margin: -2px 0 0 -2px;
    }

    /* auto hide */
    .login #login_error {
        position: absolute;
        border-radius: 6px;
        width: 322px
    }

    .login .message {
        border-radius: 6px;
        -moz-animation: cssAnimation 0s ease-in 5s forwards;
        /* Firefox */
        -webkit-animation: cssAnimation 0s ease-in 5s forwards;
        /* Safari and Chrome */
        -o-animation: cssAnimation 0s ease-in 5s forwards;
        /* Opera */
        animation: cssAnimation 0s ease-in 5s forwards;
        -webkit-animation-fill-mode: forwards;
        animation-fill-mode: forwards;
    }

    @keyframes cssAnimation {
        to {
            padding: 0;
            width: 0;
            height: 0;
            overflow: hidden;
        }
    }

    @-webkit-keyframes cssAnimation {
        to {
            padding: 0;
            width: 0;
            height: 0;
            visibility: hidden;
        }
    }


    .button-secondary {
        padding-top: 10px !important;
        padding-left: 40px !important;
    }

    .clear {
        display: none
    }

    .login form .forgetmenot label {
        font-size: 14px !important;
    }

    #rememberme {
        float: right;
        margin-top: 0px;
    }

    .forgetmenot input[type=checkbox] {
        height: 0;
        width: 0;
        visibility: hidden;
    }

    .forgetmenot label {
        cursor: pointer;
        text-indent: -999.9px;
        width: 21.0px;
        height: 11.0px;
        background: grey;
        display: block;
        border-radius: 10.0px;
        position: relative;
    }

    .forgetmenot label:after {
        content: '';
        position: absolute;
        top: 1px;
        left: 1px;
        width: 9.0px;
        height: 9.0px;
        background: #fff;
        border-radius: 9.0px;
        transition: 0.3s;
    }

    .forgetmenot input:checked+label:after {
        left: calc(100% - 1px);
        transform: translateX(-100%);
    }

    .forgetmenot label:active:after {
        width: 13.0px;
    }
</style>
<?php }
add_action( 'login_enqueue_scripts', 'wptutsplus_login_logo' );
?>